package com.youlai.system.model.form;

import com.baomidou.mybatisplus.annotation.TableField;
import com.youlai.system.common.util.JsonArrayToStringListTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.util.List;

/**
 * @version 1.0
 * @Author zzps
 * @Date 2024/3/11 23:30
 * @注释
 */
@Schema(description = "商品表单对象")
@Data
public class ProductFrom {
    @Schema(description = "商品id")
    private Long id;
    @Schema(description = "分类id")
    @NotNull(message = "分类id不能为空")
    private Integer categoryId;
    @Schema(description = "商品系列")
    @Size(max = 100, message = "商品系列最大长度为100")
    private String itemType;
    @Schema(description = "商品标题")
    @Size(min= 1,max = 100, message = "商品标题长度为1-100")
    private String title;
    @Schema(description = "商品卖点")
    @Size(max = 150, message = "商品卖点最大长度为150")
    private String sellPoint;
    @Schema(description = "商品单价")
    private Long price;
    @Schema(description = "库存数量")
    private Integer num;
    @Schema(description = "图片路径")
    private String image;
    @Schema(description = "商品状态")
    @NotNull(message = "商品状态不能为空")
    @Min(value = 0, message = "商品状态最小值为0")
    @Max(value = 1, message = "商品状态最大值为1")
    private Integer status;
    @Schema(description = "显示优先级")
    private Integer priority;
    @Schema(description = "商品缩略图")
    @TableField(typeHandler = JsonArrayToStringListTypeHandler.class)
    private List<String> thumbnails;
}
